package com.ruoyi.system.service.cloudroom.impl;

import com.ruoyi.common.cloudroom.UrlConstant;
import com.ruoyi.common.utils.cloudroom.HttpUtil;
import com.ruoyi.system.domain.vo.cloudroom.bean.BaseDto;
import com.ruoyi.system.domain.vo.cloudroom.bean.ProjectDto;
import com.ruoyi.system.service.cloudroom.ProjectService;
import org.springframework.stereotype.Service;

@Service
public class ProjectServiceImpl implements ProjectService {
    @Override
    public String add(String projectName, Integer authType) throws Exception {
        return HttpUtil.postToStr(UrlConstant.ADD_PROJECT_URL, new ProjectDto(projectName, authType).toString());
    }

    @Override
    public String query() throws Exception {
        return HttpUtil.postToStr(UrlConstant.QUERY_PROJECT_LIST_URL, new BaseDto().toString());
    }

    @Override
    public String delete(String operateAppId) throws Exception {
        return HttpUtil.postToStr(UrlConstant.DELETE_PROJECT_URL, new ProjectDto(operateAppId).toString());
    }

    @Override
    public String update(String operateAppId, Integer authType, Integer status) throws Exception {
        return HttpUtil.postToStr(UrlConstant.UPDATE_PROJECT_URL, new ProjectDto(operateAppId, authType, status).toString());
    }

    @Override
    public String updateSecret(String operateAppId) throws Exception {
        return HttpUtil.postToStr(UrlConstant.UPDATE_PROJECT_SECRET_URL, new ProjectDto(operateAppId).toString());
    }
}
